package com.mock.water.core.aop;

import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor;

import java.lang.reflect.Method;

/**
 * 自定义方法切入点
 *
 * 测试方法中使用，全局搜
 * @Author ifredomvip@gmail.com
 * @Date 2023/3/31 0:56
 */
@SuppressWarnings("serial")
public class CustomAdvisor extends StaticMethodMatcherPointcutAdvisor  {


    public CustomAdvisor() {
        setAdvice(new CustomMethodInterceptor());
    }

    @Override
    public boolean matches(Method method, Class<?> targetClass) {
        if ("foo".equals(method.getName())) {
            return true;
        }
        return false;
    }
}
